/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.diamondsys.embrapa;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Pablo
 */
@Entity
@Table(name = "visitas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Visitas.findAll", query = "SELECT v FROM Visitas v ORDER BY v.dataAtendimento ASC"),
    @NamedQuery(name = "Visitas.findById", query = "SELECT v FROM Visitas v WHERE v.id = :id"),
    @NamedQuery(name = "Visitas.findByDataAtendimento", query = "SELECT v FROM Visitas v WHERE v.dataAtendimento = :dataAtendimento"),
    @NamedQuery(name = "Visitas.findByDataEntrada", query = "SELECT v FROM Visitas v WHERE v.dataEntrada = :dataEntrada"),
    @NamedQuery(name = "Visitas.findByHoraEntrada", query = "SELECT v FROM Visitas v WHERE v.horaEntrada = :horaEntrada"),
    @NamedQuery(name = "Visitas.findByDataSaida", query = "SELECT v FROM Visitas v WHERE v.dataSaida = :dataSaida"),
    @NamedQuery(name = "Visitas.findByHoraSaida", query = "SELECT v FROM Visitas v WHERE v.horaSaida = :horaSaida"),
    @NamedQuery(name = "Visitas.findByCracha", query = "SELECT v FROM Visitas v WHERE v.cracha = :cracha"),
    @NamedQuery(name = "Visitas.findByRhTbFuncionarioCodFunc", query = "SELECT v FROM Visitas v WHERE v.rhTbFuncionarioCodFunc = :rhTbFuncionarioCodFunc")})
public class Visitas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "data_atendimento")
    @Temporal(TemporalType.DATE)
    private Date dataAtendimento;
    @Basic(optional = false)
    @NotNull
    @Column(name = "data_entrada")
    @Temporal(TemporalType.DATE)
    private Date dataEntrada;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hora_entrada")
    @Temporal(TemporalType.TIME)
    private Date horaEntrada;
    @Column(name = "data_saida")
    @Temporal(TemporalType.DATE)
    private Date dataSaida;
    @Column(name = "hora_saida")
    @Temporal(TemporalType.TIME)
    private Date horaSaida;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "cracha")
    private String cracha;
    @Lob
    @Size(max = 2147483647)
    @Column(name = "observacao")
    private String observacao;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "rh_tb_funcionario_cod_func")
    private String rhTbFuncionarioCodFunc;
    @JoinColumn(name = "tb_inst_cod_instituicao", referencedColumnName = "cod_instituicao")
    @ManyToOne(optional = false)
    private TbInst tbInstCodInstituicao;
    @JoinColumn(name = "finalidade_visita_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private FinalidadeVisita finalidadeVisitaId;

    public Visitas() {
    }

    public Visitas(Integer id) {
        this.id = id;
    }

    public Visitas(Integer id, Date dataAtendimento, Date dataEntrada, Date horaEntrada, String cracha, String rhTbFuncionarioCodFunc) {
        this.id = id;
        this.dataAtendimento = dataAtendimento;
        this.dataEntrada = dataEntrada;
        this.horaEntrada = horaEntrada;
        this.cracha = cracha;
        this.rhTbFuncionarioCodFunc = rhTbFuncionarioCodFunc;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDataAtendimento() {
        return dataAtendimento;
    }

    public void setDataAtendimento(Date dataAtendimento) {
        this.dataAtendimento = dataAtendimento;
    }

    public Date getDataEntrada() {
        return dataEntrada;
    }

    public void setDataEntrada(Date dataEntrada) {
        this.dataEntrada = dataEntrada;
    }

    public Date getHoraEntrada() {
        return horaEntrada;
    }

    public void setHoraEntrada(Date horaEntrada) {
        this.horaEntrada = horaEntrada;
    }

    public Date getDataSaida() {
        return dataSaida;
    }

    public void setDataSaida(Date dataSaida) {
        this.dataSaida = dataSaida;
    }

    public Date getHoraSaida() {
        return horaSaida;
    }

    public void setHoraSaida(Date horaSaida) {
        this.horaSaida = horaSaida;
    }

    public String getCracha() {
        return cracha;
    }

    public void setCracha(String cracha) {
        this.cracha = cracha;
    }

    public String getObservacao() {
        return observacao;
    }

    public void setObservacao(String observacao) {
        this.observacao = observacao;
    }

    public String getRhTbFuncionarioCodFunc() {
        return rhTbFuncionarioCodFunc;
    }

    public void setRhTbFuncionarioCodFunc(String rhTbFuncionarioCodFunc) {
        this.rhTbFuncionarioCodFunc = rhTbFuncionarioCodFunc;
    }

    public TbInst getTbInstCodInstituicao() {
        return tbInstCodInstituicao;
    }

    public void setTbInstCodInstituicao(TbInst tbInstCodInstituicao) {
        this.tbInstCodInstituicao = tbInstCodInstituicao;
    }

    public FinalidadeVisita getFinalidadeVisitaId() {
        return finalidadeVisitaId;
    }

    public void setFinalidadeVisitaId(FinalidadeVisita finalidadeVisitaId) {
        this.finalidadeVisitaId = finalidadeVisitaId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Visitas)) {
            return false;
        }
        Visitas other = (Visitas) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.diamondsys.embrapa.Visitas[ id=" + id + " ]";
    }
    
}
